/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - graphics/shaders
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEShaderConstantTableEntry.h
// Author:		Gianluca Belardelli
// Date:		29/01/2015
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AESHADERCONSTANTTABLEENTRY_H_
#define _AESHADERCONSTANTTABLEENTRY_H_

AE_DLLIMPEXP AEINT32 GetRegisterCountFromValueType( AEValueType eType );

#define MAX_CONSTANT_NAMELEN	32

/// \brief
///   Represents a single entry in a table of type VShaderConstantTable
struct AEShaderConstantTableEntry
{
	char		szVarname[ MAX_CONSTANT_NAMELEN ];
	AEValueType	eValueType;
	AEINT32		nArrayElements;
	AEINT32		nRegisterIndex;

	/// \brief
	///   Constructor
	AE_FORCEINLINE AEShaderConstantTableEntry( void );

	/// \brief
	///   Copies an Entry
	AE_FORCEINLINE AEShaderConstantTableEntry &operator = (const AEShaderConstantTableEntry &other );

	/// \brief
	///   Returns whether the register index is valid
	AE_FORCEINLINE AEBOOL32 IsValid( void ) const;
  
	/// \brief
	///   Returns whether this entry targets a shader constant buffer (e.g. float type) and not a
	///   texture sampler etc.
	AE_FORCEINLINE AEBOOL32 IsConstantBufferEntry( void ) const;

	/// \brief
	///   Returns whether this entry targets a texture sampler.
	AE_FORCEINLINE AEBOOL32 IsSamplerType( void ) const;


	/// \brief
	///   Evaluates the number of constant table registers used by this entry (using type and array
	///   size)
	AE_FORCEINLINE AEINT32 GetRegisterCount( void ) const;

	/// \brief
	///   Returns the min/max register index used by this entry
	AE_FORCEINLINE void GetRegisterRange( AEINT32 &nFirst, AEINT32 &nLast ) const;
};

#include "AEShaderConstantTableEntry.inl"

#endif // _AESHADERCONSTANTTABLEENTRY_H_
